package com.ita.tba.util;

import java.util.HashMap;
import java.util.Map;

public class DidNumUtil {
	
	public static Map<Integer, Integer> didNumStrToMap(String didNumStr) {
		Map<Integer, Integer> didNumMap = new HashMap<Integer, Integer>();
		String[] didNums = didNumStr.split(";");
		for (String string : didNums) {
			String[] keyValue = string.split(",");
			didNumMap.put(Integer.parseInt(keyValue[0]), Integer.parseInt(keyValue[1]));	
		}
		
		return didNumMap;
	}
	
	public static String didNumMapToStr(Map<Integer, Integer> didNumMap) {
		String didNumStr = "";
		for (Integer did : didNumMap.keySet()) {
			didNumStr = didNumStr + did + "," + didNumMap.get(did) + ";";
		}
		
		return didNumStr;
	}
	
}
